home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / nihcl-30.lha / nihcl-3.0 / test / identdict.c < prev    next >
C/C++ Source or Header  |  1990-05-20  |  2KB  |  62 lines

  1. /* Test class IdentDict
  2.  
  3.     THIS SOFTWARE FITS THE DESCRIPTION IN THE U.S. COPYRIGHT ACT OF A
  4.     "UNITED STATES GOVERNMENT WORK".  IT WAS WRITTEN AS A PART OF THE
  5.     AUTHOR'S OFFICIAL DUTIES AS A GOVERNMENT EMPLOYEE.  THIS MEANS IT
  6.     CANNOT BE COPYRIGHTED.  THIS SOFTWARE IS FREELY AVAILABLE TO THE
  7.     PUBLIC FOR USE WITHOUT A COPYRIGHT NOTICE, AND THERE ARE NO
  8.     RESTRICTIONS ON ITS USE, NOW OR SUBSEQUENTLY.
  9.  
  10. Author:
  11.     K. E. Gorlen
  12.     Bg. 12A, Rm. 2033
  13.     Computer Systems Laboratory
  14.     Division of Computer Research and Technology
  15.     National Institutes of Health
  16.     Bethesda, Maryland 20892
  17.     Phone: (301) 496-1111
  18.     uucp: uunet!nih-csl!kgorlen
  19.     Internet:kgorlen@alw.nih.gov
  20.  
  21. Function:
  22.     
  23. Modification History:
  24.     
  25. $Log:    identdict.c,v $
  26.  * Revision 3.0  90/05/20  18:12:42  kgorlen
  27.  * Release for 1st edition.
  28.  * 
  29. */
  30. static char rcsid[] = "$Header: /afs/alw.nih.gov/unix/sun4_40c/usr/local/src/nihcl-3.0/share/test/RCS/identdict.c,v 3.0 90/05/20 18:12:42 kgorlen Rel $";
  31.  
  32. #include "Point.h"
  33. #include "IdentDict.h"
  34. #include "Assoc.h"
  35. #include "AssocInt.h"
  36. #include "SortedCltn.h"
  37.  
  38. main()
  39. {
  40.     cout << "\nTest class IdentDict" << endl;
  41.     IdentDict d(16);
  42.     Point a(1,1), b(1,2), c(1,3);
  43.     AssocInt asc(c,3);
  44.     d.add(*new AssocInt(a,1));
  45.     d.add(*new AssocInt(b,2));
  46.     d.add(asc);
  47.     cerr << "d = ";  d.dumpOn(cerr);
  48.     cout << "d.atKey(a): " << *(d.atKey(a)) << endl;
  49.     cout << "d.includesKey(Point(1,1)): " << d.includesKey(Point(1,1)) << endl;
  50.     d.atKey(a,*new Integer(0));
  51.     cout << "d.atKey(a): " << *(d.atKey(a)) << endl;
  52.     cout << "d.includesAssoc(asc): " << d.includesAssoc(asc) << endl;
  53.     cout << "d.includesKey(" << (*asc.key()) << "): " << d.includesKey(*asc.key()) << endl;
  54.     cout << "d.keyAtValue(Integer(0)) = " << *d.keyAtValue(Integer(0)) << endl;
  55.     d.removeKey(c);
  56.     cout << "d.includesAssoc(asc): " << d.includesAssoc(asc) << endl;
  57.     cout << "d.includesKey(" << (*asc.key()) << "): " << d.includesKey(*asc.key()) << endl;
  58.     SortedCltn keys,vals;
  59.     cout << "d.addKeysTo(keys): " << d.addKeysTo(keys) << endl;
  60.     cout << "d.addValuesTo(vals): " << d.addValuesTo(vals) << endl;
  61. }
  62.